package org.shagin.jfin.data.model;

import org.shagin.jfin.core.CoreUtils;
import org.shagin.jfin.data.Money;
import org.shagin.jfin.date.cond.IDateCondition;

/**
 * The Class OperationRuleAction.
 */
public class OperationRuleAction {

    private OperationRule operationRule;
    private IDateCondition dateCondition;
    private Money money;

    /**
     * Instantiates a new operation rule action.
     * 
     * @param dateCondition the date condition
     * @param money the money
     */
    public OperationRuleAction(IDateCondition dateCondition, Money money) {
        CoreUtils.checkNotNull(dateCondition, "dateCondition");
        CoreUtils.checkNotNull(money, "money");
        this.dateCondition = dateCondition;
        this.money = money;
    }

    /**
     * Gets the date condition.
     * 
     * @return the date condition
     */
    public IDateCondition getDateCondition() {
        return dateCondition;
    }

    /**
     * Gets the money.
     * 
     * @return the money
     */
    public Money getMoney() {
        return money;
    }

    /**
     * Sets the date condition.
     * 
     * @param dateCondition the new date condition
     */
    public void setDateCondition(IDateCondition dateCondition) {
        this.dateCondition = dateCondition;
    }

    /**
     * Gets the operation rule.
     * 
     * @return the operation rule
     */
    public OperationRule getOperationRule() {
        CoreUtils.assertNotNull(operationRule, "operationRule");
        return operationRule;
    }

    /**
     * Sets the operation rule.
     * 
     * @param operationRule the new operation rule
     */
    public void setOperationRule(OperationRule operationRule) {
        this.operationRule = operationRule;
    }

    /**
     * Sets the money.
     * 
     * @param money the new money
     */
    public void setMoney(Money money) {
        this.money = money;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public String toString() {
        // TODO Localize
        StringBuilder sb = new StringBuilder();
        sb.append(money.toString()).append(" ")
                .append(dateCondition.toString());
        return sb.toString();
    }
}
